package think.thread.sychron.c02.toast;

public class ToastJam implements Runnable{
	
	private ToastQueue butter,jam;
	
	public ToastJam(ToastQueue butter,ToastQueue jam){
		this.butter=butter;
		this.jam=jam;
	}
	
	public void run() {
		try {
			while(!Thread.interrupted()){
				Toast toast=butter.take();
				toast.jam();
				System.out.println(toast);
				jam.put(toast);
			}
		} catch (Exception e) {
			System.out.println("exit via interrupted...");
		}
	}
	
}
